package tiled.mapeditor.widget;

import tiled.mapeditor.brush.AbstractBrush;

import javax.swing.*;
import java.awt.*;

public class BrushPreview extends JPanel
{
    private AbstractBrush brush;

    public BrushPreview()
    {
        setPreferredSize(new Dimension(22, 22));
    }

    public void setBrush(AbstractBrush brush)
    {
        this.brush = brush;
    }

    public void paint(Graphics graphics)
    {
        if (brush != null)
        {
            brush.drawPreview((Graphics2D)graphics, getSize(), null);
        }
    }
}
